import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'

// 密钥对生成 http://web.chacuo.net/netrsakeypair

const publicKey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8YQshjH85DxYAnRKfvj53CrA5\n' +
    '1FTPvc1CHhUoYwWfcB98xsq77XQb7Ltd/BSCCF1lBbUrgr2l8z6pmtr5H1b7KjIO\n' +
    'lDa+mW9OeB1w/Lyld5qxvM1RDHaIUvEgtvsdYWG3szBAusOaQUDa4lmq/ORr5QJg\n' +
    '6zRD+8gPEKzqf+a7KwIDAQAB'

// const privateKey

// 加密
export function encrypt(txt) {
  const encryptor = new JSEncrypt()
  encryptor.setPublicKey(publicKey) // 设置公钥
  return encryptor.encrypt(txt) // 对数据进行加密
}

// 解密
/*export function decrypt(txt) {
  const encryptor = new JSEncrypt()
  encryptor.setPrivateKey(privateKey) // 设置私钥
  return encryptor.decrypt(txt) // 对数据进行解密
}*/

